<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LINE 2 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LINE 6 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      :  Graphics.Win32.Misc</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   :  (c) Alastair Reid, 1997-2003</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Maintainer  :  Esa Ilari Vuokko &lt;ei@vuokko.info&gt;</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Stability   :  provisional</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- A collection of FFI declarations for interfacing with Win32.</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Graphics.Win32.Misc</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Graphics.Win32.GDI.Types</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Maybe</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign</span><span class="hs-cpp">

#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- Resources</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- (should probably be distributed between</span><span>
</span><span id="line-35"></span><span class="hs-comment">--  Graphics.Win32.{Icon,Cursor,Accelerator,Menu,...})</span><span>
</span><span id="line-36"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">Accelerator</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">LPCTSTR</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- intToAccelerator :: Int -&gt; Accelerator</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- intToAccelerator i = makeIntResource (toWord i)</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-comment">-- cursor and icon should not be const pointer; GSL ???</span><span>
</span><span id="line-43"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">Cursor</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">LPTSTR</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- intToCursor :: Int -&gt; Cursor</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- intToCursor i = makeIntResource (toWord i)</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">Icon</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">LPTSTR</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- intToIcon :: Int -&gt; Icon</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- intToIcon i = makeIntResource (toWord i)</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-identifier">loadAccelerators</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Accelerator</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HACCEL</span><span>
</span><span id="line-52"></span><span class="hs-identifier">loadAccelerators</span><span> </span><span class="hs-identifier">mb_inst</span><span> </span><span class="hs-identifier">accel</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-53"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;LoadAccelerators&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_LoadAccelerators</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_inst</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">accel</span><span>
</span><span id="line-54"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h LoadAcceleratorsW&quot;</span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-identifier">c_LoadAccelerators</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Accelerator</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HACCEL</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-identifier">loadCursor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Cursor</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HCURSOR</span><span>
</span><span id="line-58"></span><span class="hs-identifier">loadCursor</span><span> </span><span class="hs-identifier">mb_inst</span><span> </span><span class="hs-identifier">cursor</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-59"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;LoadCursor&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_LoadCursor</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_inst</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">cursor</span><span>
</span><span id="line-60"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h LoadCursorW&quot;</span><span>
</span><span id="line-61"></span><span>  </span><span class="hs-identifier">c_LoadCursor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Cursor</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HCURSOR</span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="hs-identifier">loadIcon</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Icon</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HICON</span><span>
</span><span id="line-64"></span><span class="hs-identifier">loadIcon</span><span> </span><span class="hs-identifier">mb_inst</span><span> </span><span class="hs-identifier">icon</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-65"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-string">&quot;LoadIcon&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_LoadIcon</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_inst</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">icon</span><span>
</span><span id="line-66"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h LoadIconW&quot;</span><span>
</span><span id="line-67"></span><span>  </span><span class="hs-identifier">c_LoadIcon</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HINSTANCE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Icon</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HICON</span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="hs-identifier">iDC_ARROW</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-70"></span><span class="hs-identifier">iDC_ARROW</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32512</span><span>
</span><span id="line-71"></span><span class="hs-identifier">iDC_IBEAM</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-72"></span><span class="hs-identifier">iDC_IBEAM</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32513</span><span>
</span><span id="line-73"></span><span class="hs-identifier">iDC_WAIT</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-74"></span><span class="hs-identifier">iDC_WAIT</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32514</span><span>
</span><span id="line-75"></span><span class="hs-identifier">iDC_CROSS</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-76"></span><span class="hs-identifier">iDC_CROSS</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32515</span><span>
</span><span id="line-77"></span><span class="hs-identifier">iDC_UPARROW</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-78"></span><span class="hs-identifier">iDC_UPARROW</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32516</span><span>
</span><span id="line-79"></span><span class="hs-identifier">iDC_SIZENWSE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-80"></span><span class="hs-identifier">iDC_SIZENWSE</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32642</span><span>
</span><span id="line-81"></span><span class="hs-identifier">iDC_SIZENESW</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-82"></span><span class="hs-identifier">iDC_SIZENESW</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32643</span><span>
</span><span id="line-83"></span><span class="hs-identifier">iDC_SIZEWE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-84"></span><span class="hs-identifier">iDC_SIZEWE</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32644</span><span>
</span><span id="line-85"></span><span class="hs-identifier">iDC_SIZENS</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Cursor</span><span>
</span><span id="line-86"></span><span class="hs-identifier">iDC_SIZENS</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32645</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-pragma">{-# LINE 80 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="hs-identifier">iDI_APPLICATION</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Icon</span><span>
</span><span id="line-82"></span><span class="hs-identifier">iDI_APPLICATION</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32512</span><span>
</span><span id="line-83"></span><span class="hs-identifier">iDI_HAND</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Icon</span><span>
</span><span id="line-84"></span><span class="hs-identifier">iDI_HAND</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32513</span><span>
</span><span id="line-85"></span><span class="hs-identifier">iDI_QUESTION</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Icon</span><span>
</span><span id="line-86"></span><span class="hs-identifier">iDI_QUESTION</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32514</span><span>
</span><span id="line-87"></span><span class="hs-identifier">iDI_EXCLAMATION</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Icon</span><span>
</span><span id="line-88"></span><span class="hs-identifier">iDI_EXCLAMATION</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32515</span><span>
</span><span id="line-89"></span><span class="hs-identifier">iDI_ASTERISK</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Icon</span><span>
</span><span id="line-90"></span><span class="hs-identifier">iDI_ASTERISK</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">castUINTPtrToPtr</span><span> </span><span class="hs-number">32516</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-pragma">{-# LINE 88 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- Message Boxes</span><span>
</span><span id="line-91"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MBStyle</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-identifier">mB_OK</span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-96"></span><span class="hs-identifier">mB_OK</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-97"></span><span class="hs-identifier">mB_OKCANCEL</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-98"></span><span class="hs-identifier">mB_OKCANCEL</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-99"></span><span class="hs-identifier">mB_ABORTRETRYIGNORE</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-100"></span><span class="hs-identifier">mB_ABORTRETRYIGNORE</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-101"></span><span class="hs-identifier">mB_YESNOCANCEL</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-102"></span><span class="hs-identifier">mB_YESNOCANCEL</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-103"></span><span class="hs-identifier">mB_YESNO</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-104"></span><span class="hs-identifier">mB_YESNO</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-105"></span><span class="hs-identifier">mB_RETRYCANCEL</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-106"></span><span class="hs-identifier">mB_RETRYCANCEL</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">5</span><span>
</span><span id="line-107"></span><span class="hs-identifier">mB_ICONHAND</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-108"></span><span class="hs-identifier">mB_ICONHAND</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-109"></span><span class="hs-identifier">mB_ICONQUESTION</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-110"></span><span class="hs-identifier">mB_ICONQUESTION</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-111"></span><span class="hs-identifier">mB_ICONEXCLAMATION</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-112"></span><span class="hs-identifier">mB_ICONEXCLAMATION</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">48</span><span>
</span><span id="line-113"></span><span class="hs-identifier">mB_ICONASTERISK</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-114"></span><span class="hs-identifier">mB_ICONASTERISK</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-115"></span><span class="hs-identifier">mB_ICONINFORMATION</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-116"></span><span class="hs-identifier">mB_ICONINFORMATION</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-117"></span><span class="hs-identifier">mB_ICONSTOP</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-118"></span><span class="hs-identifier">mB_ICONSTOP</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-119"></span><span class="hs-identifier">mB_DEFBUTTON1</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-120"></span><span class="hs-identifier">mB_DEFBUTTON1</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-121"></span><span class="hs-identifier">mB_DEFBUTTON2</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-122"></span><span class="hs-identifier">mB_DEFBUTTON2</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-123"></span><span class="hs-identifier">mB_DEFBUTTON3</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-124"></span><span class="hs-identifier">mB_DEFBUTTON3</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">512</span><span>
</span><span id="line-125"></span><span class="hs-identifier">mB_APPLMODAL</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-126"></span><span class="hs-identifier">mB_APPLMODAL</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-127"></span><span class="hs-identifier">mB_SYSTEMMODAL</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-128"></span><span class="hs-identifier">mB_SYSTEMMODAL</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4096</span><span>
</span><span id="line-129"></span><span class="hs-identifier">mB_TASKMODAL</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-130"></span><span class="hs-identifier">mB_TASKMODAL</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8192</span><span>
</span><span id="line-131"></span><span class="hs-identifier">mB_SETFOREGROUND</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStyle</span><span>
</span><span id="line-132"></span><span class="hs-identifier">mB_SETFOREGROUND</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">65536</span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span class="hs-pragma">{-# LINE 116 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MBStatus</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="hs-identifier">iDABORT</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-120"></span><span class="hs-identifier">iDABORT</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-121"></span><span class="hs-identifier">iDCANCEL</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-122"></span><span class="hs-identifier">iDCANCEL</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-123"></span><span class="hs-identifier">iDIGNORE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-124"></span><span class="hs-identifier">iDIGNORE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">5</span><span>
</span><span id="line-125"></span><span class="hs-identifier">iDNO</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-126"></span><span class="hs-identifier">iDNO</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">7</span><span>
</span><span id="line-127"></span><span class="hs-identifier">iDOK</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-128"></span><span class="hs-identifier">iDOK</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-129"></span><span class="hs-identifier">iDRETRY</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-130"></span><span class="hs-identifier">iDRETRY</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-131"></span><span class="hs-identifier">iDYES</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-132"></span><span class="hs-identifier">iDYES</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">6</span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span class="hs-pragma">{-# LINE 128 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-comment">-- Note: if the error is ever raised, we're in a very sad way!</span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="hs-identifier">messageBox</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MBStyle</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-132"></span><span class="hs-identifier">messageBox</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-identifier">caption</span><span> </span><span class="hs-identifier">style</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-133"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_text</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-134"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">caption</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_caption</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-135"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;MessageBox&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_MessageBox</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">wnd</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">c_text</span><span> </span><span class="hs-identifier">c_caption</span><span> </span><span class="hs-identifier">style</span><span>
</span><span id="line-136"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">safe</span><span> </span><span class="hs-string">&quot;windows.h MessageBoxW&quot;</span><span>
</span><span id="line-137"></span><span>  </span><span class="hs-identifier">c_MessageBox</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MBStyle</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MBStatus</span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-140"></span><span class="hs-comment">--</span><span>
</span><span id="line-141"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">StdHandleId</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-identifier">sTD_INPUT_HANDLE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">StdHandleId</span><span>
</span><span id="line-146"></span><span class="hs-identifier">sTD_INPUT_HANDLE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4294967286</span><span>
</span><span id="line-147"></span><span class="hs-identifier">sTD_OUTPUT_HANDLE</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">StdHandleId</span><span>
</span><span id="line-148"></span><span class="hs-identifier">sTD_OUTPUT_HANDLE</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4294967285</span><span>
</span><span id="line-149"></span><span class="hs-identifier">sTD_ERROR_HANDLE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">StdHandleId</span><span>
</span><span id="line-150"></span><span class="hs-identifier">sTD_ERROR_HANDLE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4294967284</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span class="hs-pragma">{-# LINE 150 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="hs-identifier">getStdHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">StdHandleId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-152"></span><span class="hs-identifier">getStdHandle</span><span> </span><span class="hs-identifier">hid</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-153"></span><span>  </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">iNVALID_HANDLE_VALUE</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;GetStdHandle&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetStdHandle</span><span> </span><span class="hs-identifier">hid</span><span>
</span><span id="line-154"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetStdHandle&quot;</span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-identifier">c_GetStdHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">StdHandleId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-158"></span><span class="hs-comment">-- Rotatable Ellipse hack</span><span>
</span><span id="line-159"></span><span class="hs-comment">--</span><span>
</span><span id="line-160"></span><span class="hs-comment">-- Win95 (Win32?) doesn't support rotating ellipses - so we</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- implement them with polygons.</span><span>
</span><span id="line-162"></span><span class="hs-comment">--</span><span>
</span><span id="line-163"></span><span class="hs-comment">-- We use a fixed number of edges rather than varying the number</span><span>
</span><span id="line-164"></span><span class="hs-comment">-- according to the radius of the ellipse.</span><span>
</span><span id="line-165"></span><span class="hs-comment">-- If anyone feels like improving the code (to vary the number),</span><span>
</span><span id="line-166"></span><span class="hs-comment">-- they should place a fixed upper bound on the number of edges</span><span>
</span><span id="line-167"></span><span class="hs-comment">-- since it takes a relatively long time to draw 1000 edges.</span><span>
</span><span id="line-168"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-identifier">transformedEllipse</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HDC</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">POINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">POINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">POINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-171"></span><span class="hs-identifier">transformedEllipse</span><span> </span><span class="hs-identifier">dc</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x0</span><span class="hs-special">,</span><span class="hs-identifier">y0</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x1</span><span class="hs-special">,</span><span class="hs-identifier">y1</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x2</span><span class="hs-special">,</span><span class="hs-identifier">y2</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-172"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;transformedEllipse&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_transformedEllipse</span><span> </span><span class="hs-identifier">dc</span><span> </span><span class="hs-identifier">x0</span><span> </span><span class="hs-identifier">y0</span><span> </span><span class="hs-identifier">x1</span><span> </span><span class="hs-identifier">y1</span><span> </span><span class="hs-identifier">x2</span><span> </span><span class="hs-identifier">y2</span><span>
</span><span id="line-173"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;ellipse.h transformedEllipse&quot;</span><span>
</span><span id="line-174"></span><span>  </span><span class="hs-identifier">c_transformedEllipse</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HDC</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-175"></span><span>
</span><span id="line-176"></span><span class="hs-pragma">{-# CFILES cbits/ellipse.c #-}</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-179"></span><span class="hs-comment">-- Cursor</span><span>
</span><span id="line-180"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span class="hs-identifier">getCursorPos</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">POINT</span><span>
</span><span id="line-183"></span><span class="hs-identifier">getCursorPos</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-184"></span><span>  </span><span class="hs-identifier">allocaPOINT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_pt</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-185"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetCursorPos&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetCursorPos</span><span> </span><span class="hs-identifier">p_pt</span><span>
</span><span id="line-186"></span><span>  </span><span class="hs-identifier">peekPOINT</span><span> </span><span class="hs-identifier">p_pt</span><span>
</span><span id="line-187"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetCursorPos&quot;</span><span>
</span><span id="line-188"></span><span>  </span><span class="hs-identifier">c_GetCursorPos</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">POINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="hs-identifier">setCursorPos</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">POINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-191"></span><span class="hs-identifier">setCursorPos</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x</span><span class="hs-special">,</span><span class="hs-identifier">y</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-192"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;setCursorPos&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetCursorPos</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-identifier">y</span><span>
</span><span id="line-193"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetCursorPos&quot;</span><span>
</span><span id="line-194"></span><span>  </span><span class="hs-identifier">c_SetCursorPos</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LONG</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-identifier">clipCursor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">RECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span class="hs-identifier">clipCursor</span><span> </span><span class="hs-identifier">rect</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-198"></span><span>  </span><span class="hs-identifier">withRECT</span><span> </span><span class="hs-identifier">rect</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_rect</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-199"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;ClipCursor&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_ClipCursor</span><span> </span><span class="hs-identifier">p_rect</span><span>
</span><span id="line-200"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h ClipCursor&quot;</span><span>
</span><span id="line-201"></span><span>  </span><span class="hs-identifier">c_ClipCursor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">RECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="hs-identifier">getClipCursor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">RECT</span><span>
</span><span id="line-204"></span><span class="hs-identifier">getClipCursor</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-identifier">allocaRECT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_rect</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-206"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetClipCursor&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetClipCursor</span><span> </span><span class="hs-identifier">p_rect</span><span>
</span><span id="line-207"></span><span>  </span><span class="hs-identifier">peekRECT</span><span> </span><span class="hs-identifier">p_rect</span><span>
</span><span id="line-208"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetClipCursor&quot;</span><span>
</span><span id="line-209"></span><span>  </span><span class="hs-identifier">c_GetClipCursor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">RECT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-212"></span><span class="hs-comment">-- Exit/shutdown</span><span>
</span><span id="line-213"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">ExitOption</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-216"></span><span>
</span><span id="line-217"></span><span class="hs-identifier">eWX_FORCE</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span>
</span><span id="line-218"></span><span class="hs-identifier">eWX_FORCE</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-219"></span><span class="hs-identifier">eWX_LOGOFF</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span>
</span><span id="line-220"></span><span class="hs-identifier">eWX_LOGOFF</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-221"></span><span class="hs-identifier">eWX_POWEROFF</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span>
</span><span id="line-222"></span><span class="hs-identifier">eWX_POWEROFF</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-223"></span><span class="hs-identifier">eWX_REBOOT</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span>
</span><span id="line-224"></span><span class="hs-identifier">eWX_REBOOT</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-225"></span><span class="hs-identifier">eWX_SHUTDOWN</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span>
</span><span id="line-226"></span><span class="hs-identifier">eWX_SHUTDOWN</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="hs-pragma">{-# LINE 224 &quot;libraries\\Win32\\Graphics\\Win32\\Misc.hsc&quot; #-}</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span class="hs-identifier">exitWindowsEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span class="hs-identifier">exitWindowsEx</span><span> </span><span class="hs-identifier">opt</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-227"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;ExitWindowsEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_ExitWindowsEx</span><span> </span><span class="hs-identifier">opt</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-228"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h ExitWindowsEx&quot;</span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-identifier">c_ExitWindowsEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ExitOption</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-identifier">exitWindows</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span class="hs-identifier">exitWindows</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">exitWindowsEx</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-235"></span><span class="hs-comment">-- Beeping</span><span>
</span><span id="line-236"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">Beep</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-239"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MbBeep</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">Beep</span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span class="hs-identifier">maybeBeep</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">Beep</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Beep</span><span>
</span><span id="line-242"></span><span class="hs-identifier">maybeBeep</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromMaybe</span><span> </span><span class="hs-number">0xffffffff</span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">Duration</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MbDuration</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">Duration</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="hs-identifier">maybeDuration</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">Duration</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Duration</span><span>
</span><span id="line-249"></span><span class="hs-identifier">maybeDuration</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromMaybe</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="hs-number">1</span><span class="hs-special">)</span><span>
</span><span id="line-250"></span><span>
</span><span id="line-251"></span><span class="hs-identifier">messageBeep</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">Beep</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span class="hs-identifier">messageBeep</span><span> </span><span class="hs-identifier">mb_beep</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-253"></span><span>  </span><span class="hs-identifier">c_MessageBeep</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybeBeep</span><span> </span><span class="hs-identifier">mb_beep</span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h MessageBeep&quot;</span><span>
</span><span id="line-255"></span><span>  </span><span class="hs-identifier">c_MessageBeep</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Beep</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-identifier">beep</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">WORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MbDuration</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span class="hs-identifier">beep</span><span> </span><span class="hs-identifier">freq</span><span> </span><span class="hs-identifier">mb_dur</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-259"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;Beep&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_Beep</span><span> </span><span class="hs-identifier">freq</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybeDuration</span><span> </span><span class="hs-identifier">mb_dur</span><span class="hs-special">)</span><span>
</span><span id="line-260"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h Beep&quot;</span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-identifier">c_Beep</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">WORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Duration</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-264"></span><span class="hs-comment">-- Timers</span><span>
</span><span id="line-265"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-266"></span><span>
</span><span id="line-267"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">TimerId</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">TIMERPROC</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">FunPtr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TimerId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span>
</span><span id="line-271"></span><span class="hs-comment">-- ToDo: support the other two forms of timer initialisation</span><span>
</span><span id="line-272"></span><span>
</span><span id="line-273"></span><span class="hs-comment">-- Cause WM_TIMER events to be sent to window callback</span><span>
</span><span id="line-274"></span><span>
</span><span id="line-275"></span><span class="hs-identifier">setWinTimer</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TimerId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">TimerId</span><span>
</span><span id="line-276"></span><span class="hs-identifier">setWinTimer</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">timer</span><span> </span><span class="hs-identifier">elapse</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;SetTimer&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetTimer</span><span> </span><span class="hs-identifier">wnd</span><span> </span><span class="hs-identifier">timer</span><span> </span><span class="hs-identifier">elapse</span><span> </span><span class="hs-identifier">nullFunPtr</span><span>
</span><span id="line-278"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetTimer&quot;</span><span>
</span><span id="line-279"></span><span>  </span><span class="hs-identifier">c_SetTimer</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TimerId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TIMERPROC</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">TimerId</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="hs-identifier">killTimer</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TimerId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-282"></span><span class="hs-identifier">killTimer</span><span> </span><span class="hs-identifier">mb_wnd</span><span> </span><span class="hs-identifier">timer</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-283"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;KillTimer&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_KillTimer</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_wnd</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">timer</span><span>
</span><span id="line-284"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h KillTimer&quot;</span><span>
</span><span id="line-285"></span><span>  </span><span class="hs-identifier">c_KillTimer</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HWND</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">TimerId</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span class="hs-comment">-- For documentation purposes:</span><span>
</span><span id="line-288"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MilliSeconds</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-289"></span><span>
</span><span id="line-290"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h timeGetTime&quot;</span><span>
</span><span id="line-291"></span><span>  </span><span class="hs-identifier">timeGetTime</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">MilliSeconds</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span class="hs-comment">-- %fun ezCreateFont :: Unknown</span><span>
</span><span id="line-296"></span><span class="hs-comment">-- %result BITMAP({ getBitmapInfo(x) })</span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-299"></span><span class="hs-comment">-- End</span><span>
</span><span id="line-300"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-301"></span></pre></body></html>